import Vue from 'vue'
import Router from 'vue-router'


// 一级路由
import Home from './../pages/home/home'
import Login from './../pages/login/login'
import LoginMember from './../pages/loginMember/loginMember'//企业会员宣传登录

//二级路由

import Integral from './../pages/member/integral' //积分榜

import ActivityList from './../pages/activity/activityList' //活动列表
import RegistrationForm from './../pages/activity/registrationForm/registrationForm' //活动列表》报名表

/**
 * 重写路由的push方法
 */
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}
Vue.use(Router)

export default new Router({
  routes: [
    {
      path:'/login',
      component: Login,
      namr: 'Login'
    },
    {
      path:'/loginMember',
      component: LoginMember,
      namr: 'LoginMember'
    },
    {
      path: '/',
      redirect:'/login'
    },
    {
      path:'/home',
      component: Home,
      redirect:'/activityList',
      namr: 'Home',
      children:[
        { path: '/activityList', component: ActivityList, name: 'ActivityList' },
        { path: '/registrationForm', component: RegistrationForm, name: 'RegistrationForm' },
        { path: '/integral', component: Integral, name: 'Integral' },
      ],
    }
  ]
})
